package com.enation.app.javashop.core.client.fallback.payment;

import com.enation.app.javashop.core.client.feignimpl.payment.PayLogClientFeignImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.enation.app.javashop.model.trade.order.dos.PayLog;
import org.springframework.stereotype.Component;

/**
 * 支付日志sdk断路器 factory
 * @author kingapex
 * @version 1.0
 * @data 2022/5/28 14:59
 **/
@Component
public class PayLogClientFallbackFactory extends BaseFallbackFactory<PayLogClientFeignImpl> {
    @Override
    protected PayLogClientFeignImpl fallback() {
        return new PayLogClientFallback();
    }

    /**
     * 支付日志sdk断路器
     *
     * @author fk create in 2020/4/7
     * @version v2.0
     * @since v7.2.0
     */
    @Component
    public static class PayLogClientFallback implements PayLogClientFeignImpl {

        private final Logger logger = LoggerFactory.getLogger(getClass());

        @Override
        public PayLog add(PayLog payLog) {
            logger.error("添加收款单异常");
            return null;
        }

        @Override
        public PayLog edit(PayLog payLog, Long id) {
            logger.error("修改收款单异常");
            return null;
        }

        @Override
        public PayLog getModel(String orderSn) {
            logger.error("根据订单号查询异常");
            return null;
        }
    }
}
